name: Release

on:
  push:
    tags:
      - "[0-9]*.[0-9]*.[0-9]*"

jobs:
  build:

    runs-on: windows-2022

    steps:
    - name: Checkout
      uses: actions/checkout@v3
    - name: Setup .NET
      uses: actions/setup-dotnet@v3
      with:
        dotnet-version: 6.0.x
    - name: Restore
      run: dotnet restore
    - name: Build
      run: .\make.bat ${{ github.ref_name }}
    - name: Release
      uses: softprops/action-gh-release@v0.1.13
      with:
        draft: true
        files: build_installer/LenovoLegionToolkitSetup.exe
        fail_on_unmatched_files: true
    - name: Upload artifact
      uses: actions/upload-artifact@v3
      with:
        name: installer
        path: build_installer/LenovoLegionToolkitSetup.exe
